package Panel;

import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
import java.awt.geom.Ellipse2D ;

public class Circle extends Shape {
	double x,y,radius;  //声明圆心坐标X,Y和半径；
	Graphics2D g1;
	Ellipse2D circle;
	AffineTransform trans;
	
	
	public  Circle(Graphics2D g,double x,double y,double radius){
		this.x=x;
		this.y=y;
		this.radius=radius;
		this.g1=g;
		circle=new Ellipse2D.Double(x,y,radius, radius);
		g.draw(circle);
		
	}
	//沿着X移动tx个像素，沿着Y移动ty个像素；
	public void translate(double tx,double ty){
		trans=new AffineTransform();	
	    trans.translate(tx, ty);
		g1.setTransform(trans);
		g1.draw(circle);			
	}
	//图像沿着X,Y方向缩放
	public void scale(double sx,double sy){ 
		trans=new AffineTransform();
		trans.scale(sx, sy);
		g1.setTransform(trans);
		g1.draw(circle);
	}
	//图像沿着坐标（x,y)旋转numle 角度
	public void rotate(double numble,double rx,double ry){
		trans=new AffineTransform();
		trans.rotate(numble, rx, ry);
		g1.setTransform(trans);
		g1.draw(circle);
	}
	//显示图形
	public void showshape() {
		g1.draw(circle);
	}
}
